import './assets/main.css'

import { createApp } from 'vue'
import App from './App.vue'
import GlobalCom from './components/GlobalCom.vue'
import router from './router/index.js'
import store from './store'

// 引入 axios, vueAxios
import axios from 'axios'
import VueAxios from 'vue-axios'

axios.defaults.baseURL = 'http://localhost:3000'


axios.interceptors.request.use((config) => {
  console.log('config', config);
  config.headers.test = 'test'
  return config
}, function (error) {
  return Promise.reject(error)
})


axios.interceptors.response.use((response) => {
  console.log('response', response);

  return response
}, function (error) {
  return Promise.reject(error)
})


const app = createApp(App)

// 注册全局组件
app.component(GlobalCom.name, GlobalCom)

// 注册路由
app.use(router)

// 注册Vuex
app.use(store)

// 注册axios，VueAxios
app.use(VueAxios, axios)


app.mount('#app')
